package com.globopt.global.old;
public class F2 extends Function {
	// Griewank function

	public F2() {
		this.nvars = 2;
	}

	@Override
	public double evaluation(double[] x) {
		double s = 0.0;
		double p = 1.0;

		for (int i = 0; i < nvars; i++) {
			s += x[i] * x[i];
			p += Math.cos(x[i] / Math.sqrt(i + 1));
		}
		return s / 4000.0 - p + 1.0;
	}
}
